package com.xhwl.data.util.excel;

public class FileNameUtil {

    /**
     * 获取文件名 ，去掉扩展后缀
     * @param filename
     * @return
     */
    public static String getFileNameNoEx(String filename) {
        if ((filename != null) && (filename.length() > 0)) {
            int dot = filename.lastIndexOf('.');
            if ((dot > -1) && (dot < (filename.length()))) {
                return filename.substring(0, dot);
            }
        }
        return filename;
    }

    /**
     * 获取文件名的后缀
     * @param fileName
     * @return
     */
    public static String getFileNameSuffix(String fileName) {
        String suffix = null;
        if ((fileName != null) && (fileName.length() > 0)) {
            suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
        }
        return suffix;
    }


}
